;*****************************************************************************************************
;+
; NAME:
;
;      IGL_GetSysVars
;
; PURPOSE:
;
;      This routine is used to get the value of internal private
;      variables needed by the Interactive Graphics Library. It should
;      never be called directly by the user.
;
; CALLING SEQUENCE:
;
;      value = IGL_GetSysVars(varName)
;
; ARGUMENTS:
;
;      VARNAME:     The name of the internal variable for which the
;                   caller needs the value
;                 
; KEYWORD PARAMETERS:
;
;      None.
;
; PACKAGE:
;
;    Interactive Graphics Library (IGL)
;
; AUTHORS:
;
;        RAPHAEL SADOUN
;        Graduate Student
;        Institut d'Astrophysique de Paris
;        98 bis boulevard Arago
;        75014 PARIS FRANCE
;        E-mail: raphael.sadoun@gmail.com
;
;
; MODIFICATION HISTORY:
;
;     Written by: Raphael Sadoun, 24 April 2012
;-
;*****************************************************************************************************
FUNCTION IGL_GetSysVars, VarName

  COMPILE_OPT idl2, HIDDEN  
  ON_ERROR, 2
  
  COMMON __IGL_PrivateVars__, privateGlobalObj

  ;; If the CATLIST object is not initialized, issue an error.
  IF (NOT OBJ_VALID(privateGlobalObj)) $
  THEN message, 'IGL system variables not initialized. Use IGL_InitSysVars first!'

  ;; Retrieve the value of the given variable
  value = privateGlobalObj -> GetValue(VarName,success=success)
  IF (NOT success) THEN message, 'IGL system variable "'+VarName+'" is not defined'
  
  IF (n_elements(value) EQ 1) THEN return, value[0] ELSE return, value
  
END
